package cn.edu.scau.cmi.yangzemin.composite.consistent;

import java.util.ArrayList;
import java.util.List;
public class ConsistentTeam extends ConsistentOrganization{
	private String name;
	private List<ConsistentOrganization> team=new ArrayList<ConsistentOrganization>();
	public ConsistentOrganization searchOrganization(String OrganizationName) {
		for(ConsistentOrganization so:team) {
			if(so.getName().equals(OrganizationName))
				return so;
		}
		System.out.println("the person is not exist");
		return null;
	}
	@Override
	public void getTeam(int level) {
		String space=" ";
		int i;
		for(i=1;i<level;i++)
			space+="  ";
		System.out.println(space+this.getName());
		for(ConsistentOrganization so:team) {
			level++;
			so.getTeam(i+1);
		}
		level--;
	}
	@Override
	public String getName() {
		return name;
	}
	public void setTeam(List<ConsistentOrganization> team) {
		this.team=team;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public void addOrganization(ConsistentOrganization organization) {
		team.add(organization);
	}
	@Override
	public void removeOrganization(ConsistentOrganization organization) {
		team.remove(organization);
	}
}